-- GENERATED SPELL FOR [Sunfury Nethermancer] --


function spell0_20248(pUnit, Event) --@Bloodcrystal Surge,Self--
pUnit:FullCastSpellOnTarget(35778,pUnit)
pUnit:RegisterEvent('Sorts_20248', 20333, 1)
end

function spell1_20248(pUnit, Event) --@Drain Life,Drain--
pUnit:FullCastSpellOnTarget(17173,pUnit:GetRandomPlayer(0))
pUnit:RegisterEvent('Sorts_20248', 5000, 1)
end

function spell2_20248(pUnit, Event) --@Shadow Bolt,n/a--
pUnit:FullCastSpellOnTarget(9613,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_20248', 3000, 1)
end

function spell3_20248(pUnit, Event) --@Summon Mana Beast,n/a--
pUnit:FullCastSpellOnTarget(36477,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_20248', 678, 1)
end

function Sorts_20248(pUnit, Event)
local choix_sorts_20248 = math.random(0, 3)
if choix_sorts_20248 == 0 then
pUnit:RegisterEvent('spell0_20248', 1, 1)
end
if choix_sorts_20248 == 1 then
pUnit:RegisterEvent('spell1_20248', 1, 1)
end
if choix_sorts_20248 == 2 then
pUnit:RegisterEvent('spell2_20248', 1, 1)
end
if choix_sorts_20248 == 3 then
pUnit:RegisterEvent('spell3_20248', 1, 1)
end
end

function mob20248_Action(pUnit, Event)
pUnit:RegisterEvent('Sorts_20248', math.random(1500, 3000), 1)
end

function mob20248_Leave(pUnit, Event)
--pUnit:RemoveEvents();--
end

function mob20248_Kill(pUnit, Event)
--pUnit:RemoveEvents();--
end

function mob20248_Die(pUnit, Event)
pUnit:RemoveEvents();
end

RegisterUnitEvent(20248, 1, 'mob20248_Action')
RegisterUnitEvent(20248, 2, 'mob20248_Leave')
RegisterUnitEvent(20248, 3, 'mob20248_Kill')
RegisterUnitEvent(20248, 4, 'mob20248_Die')
